
# encoding:utf-8
from flask import Flask, render_template, url_for, request, json,jsonify
import json
 
app = Flask(__name__)
#设置编码
app.config['JSON_AS_ASCII'] = False
 
 
#接收参数，并返回json数据
@app.route('/sendDate', methods=['GET', 'POST'])
def form_data():
   data = request.get_data()
   print(data)
   json_data = json.loads(data.decode("utf-8"))
   print(json_data)
   '''
   #从request中获取表单请求的参数信息
   title = request.form['title']
   datetime = request.form['datetime']
   quiz = request.form['quiz']
   '''
   
   #此处逻辑代码已经省略...................
 
   return jsonify({'status': '0', 'errmsg': '登录成功！'})
 
 
#测试入口
@app.route('/test')
def hello_world():
    return 'Hello World!'
 
 
if __name__ == '__main__':
    app.run()
'''
--------------------- 
作者：Williams Yan 
来源：CSDN 
原文：https://blog.csdn.net/u010197393/article/details/83503202 
版权声明：本文为博主原创文章，转载请附上博文链接！
'''